package com.example.petadopt.service;

import com.example.petadopt.dao.DictionaryRepository;
import com.example.petadopt.entity.Dictionary;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Optional;

@Service
public class DictionaryService {
    @Autowired
    private DictionaryRepository dictionaryRepository;

    public Optional<Dictionary> findById(Integer id) {
        return dictionaryRepository.findById(id);
    }
    public List<Dictionary> getStatusList() {
        return dictionaryRepository.findByType("status");
    }

    public Dictionary getStatusById(int statusId) {
        return dictionaryRepository.findById(statusId).orElse(null);
    }
}